/** ============================================================================================== **/
/**						GESTIONE DELLE PIANTE									 				   **/	
/** ============================================================================================== **/
//Servizio
BootApplication.service("PreferFishService",
				    ['configuration', '$rootScope', 'ngDialog', 'DateService', 'log', 'DialogService', '$translate', '$http', '$q',
			 function(configuration ,  $rootScope ,  ngDialog ,  DateService,   log ,  DialogService ,  $translate ,  $http ,  $q) {
	  
	console.log("PreferFishService");			    	
	/**
	 * Questo metodo aggiorna la lista dei grafici da visualizzare in base ai filtri attivi
	 **/
	this.getFishList = function( _filtriAttivi, _displayProp ) {
		 _searchModel = {};
		 _searchModel.iDisplayStart		= _displayProp.displayStart;
		 _searchModel.iDisplayLength	= _displayProp.displayLength;
		 _searchModel.paginate			= _displayProp.paginate;
		 if ( _filtriAttivi!=null) {
			 _searchModel.nome		 		= _filtriAttivi.nome;
		 }
		 var _defer = $q.defer();
		 var request = {
				  method	: 'POST'
				  ,url		: configuration.getParam("Constants").ContextPath + "fishCtrl/searchFish.pjson"
				  ,data  	: _searchModel
		 };
  	  	 $http(request).then(function(response){_defer.resolve(response);}, function(errorResponse){_defer.resolve(null);});
  	  	 return _defer.promise;
	 }
}]);